﻿Public Class RparametroSist

    Public Shared Function SeleccionarTodo(ByVal descEmpresa As String, ByVal DisplaySelect As Boolean) As List(Of EparametroSist)
        Dim parametros As List(Of EparametroSist) = Nothing

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                parametros = DparametroSist.SeleccionarTodo(descEmpresa)
                If parametros Is Nothing Then parametros = New List(Of EparametroSist)
                If DisplaySelect Then parametros.Insert(0, New EparametroSist("00", "-- SELECCIONAR --"))
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return parametros
    End Function
    Public Shared Function Añadir(ByVal descEmpresa As String, ByVal pParametroSist As EparametroSist) As Boolean
        Dim resultado As Boolean = False

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                resultado = DparametroSist.Añadir(descEmpresa, pParametroSist)
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return resultado
    End Function
    Public Shared Function Editar(ByVal descEmpresa As String, ByVal pParametroSist As EparametroSist) As Boolean
        Dim resultado As Boolean = False

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                resultado = DparametroSist.Editar(descEmpresa, pParametroSist)
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return resultado
    End Function

End Class
